package models;

import com.shove.Convert;
import play.db.jpa.Model;

import javax.persistence.Entity;
import java.util.Date;

/**
 * Created by Administrator on 2018-04-14.
 */
@Entity
public class customer_info extends Model {
    public long business_id;
    public String customer_name;
    public String filename;
    public Date buy_date;
    public Double sum_price;
    public int all_count;
    public double single_price;
    public int pay_status;
    public String common;
    public String customer_level;
    public String customer_source;
    public Date create_date;

    public String getSum_price() {
        java.text.DecimalFormat   df   =new   java.text.DecimalFormat("#.00");
        return df.format(sum_price);
    }
    public String getSingle_price() {
        java.text.DecimalFormat   df   =new   java.text.DecimalFormat("#.00");
        return df.format(single_price);
    }

    public String getBuy_date(){
        return Convert.dateToStr(buy_date,"yyyy-MM-dd","");
    }
    public String getCreate_date(){
        return Convert.dateToStr(create_date,"yyyy-MM-dd","");
    }

    public String getBusinessId(){
        sys_user sysUser = sys_user.findById(business_id);
        if(sysUser!=null)
        {
            return sysUser.username;
        }
        return "空";
    }

    public String getPay_status() {
        if(this.pay_status==1){
            return  "已付款";
        }else{
            return "待付款";
        }
    }
}
